package com.vecspace.middleplatform.filemanagment.httphandler;
import java.util.ArrayList;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;

import com.vecspace.data.model.FilterColumn;
import com.vecspace.database.model.QueryResult;
import com.vecspace.middleplatform.filemanagment.pojo.UploadFile;
import com.vecspace.middleplatform.filemanagment.service.UploadFileService;
import com.vecspace.web.servlet.model.BaseController;
import com.vecspace.web.servlet.model.FtlViewModel;
import com.vecspace.web.servlet.model.HttpHandler;
import com.vecspace.web.servlet.model.Param;
import com.vecspace.web.servlet.model.Path;
import com.vecspace.web.servlet.model.ViewModel;

/** 文件上传记录 httphandler
 * 在handler中进行与页面相关的处理，比如把数据转换为HTML格式等。
 * @reviewer
 * @template wanghua
 * @version 1.0
*/
@HttpHandler()
public class UploadFileRecordHandler extends BaseController {

	/**
	 * 根据多个查询条件执行分页查询 
	 * 
	 * @param queryFields	查询条件
	 * @param pageIndex	  页数 从1开始
	 * @param pageSize	   每页显示的数据条数
	 * @param sortField	  排序字段
	 * @param sortOrder	  排序方式 asc desc
	 * @return PageModel
	 * @throws Exception
	 * @reviewer
	 */
	@Path("getUploadFileRecordExList")
	public QueryResult<UploadFile> getUploadFileRecordExList(@Param("queryFields") ArrayList<FilterColumn> queryFields,
			@Param("page") int page, @Param("limit") int pageSize, @Param("sortname") String sortname, @Param("sortorder") String sortorder, @Param("year") String year) throws Exception {
		return uploadFileService.getUploadFileRecordExList(queryFields, page, pageSize, sortname, sortorder, year);
	}

	/************** Page View *************************/
	/**跳转到信息列表页面
	 * @return ViewModel
	 * @throws Exception
	 * @reviewer
	 */
	@Path(value="list", httpGet=true)
	public ViewModel list() throws Exception {
		Map<String, Object> params = this.getRequestParameters();
		return new FtlViewModel("view/vecspace/middleplatform/filemanagementpart/uploadFileRecord/uploadFileRecord_list.ftl", params);
	}

	/************* property ********************/
	@Autowired
	private UploadFileService uploadFileService;
	public UploadFileService getuploadFileService() {
		return uploadFileService;
	}
	public void setUploadFileStorageService(UploadFileService uploadFileService) {
		this.uploadFileService = uploadFileService;
	}

}
